using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Matrix.Notification.Domain.Shared.Notifications;

namespace Matrix.Notification.Notifications
{
    /// <summary>
    /// 发送模板通知请求DTO
    /// </summary>
    public class SendTemplateNotificationDto
    {
        /// <summary>
        /// 模板ID
        /// </summary>
        [Required]
        public Guid TemplateId { get; set; }

        /// <summary>
        /// 模板数据
        /// </summary>
        public Dictionary<string, object>? TemplateData { get; set; }

        /// <summary>
        /// 通知类型
        /// </summary>
        [Required]
        public NotificationType Type { get; set; }

        /// <summary>
        /// 通知优先级
        /// </summary>
        public NotificationPriority Priority { get; set; } = NotificationPriority.Normal;

        /// <summary>
        /// 通知渠道
        /// </summary>
        [Required]
        public NotificationChannel Channel { get; set; }

        /// <summary>
        /// 接收者ID
        /// </summary>
        [Required]
        public Guid Recipient { get; set; }

        /// <summary>
        /// 接收者用户名
        /// </summary>
        [StringLength(100)]
        public string? RecipientUserName { get; set; }

        /// <summary>
        /// 接收者邮箱
        /// </summary>
        [EmailAddress]
        [StringLength(255)]
        public string? RecipientEmail { get; set; }

        /// <summary>
        /// 接收者手机号
        /// </summary>
        [Phone]
        [StringLength(20)]
        public string? RecipientPhoneNumber { get; set; }

        /// <summary>
        /// 发送者ID
        /// </summary>
        public Guid? SenderId { get; set; }

        /// <summary>
        /// 发送者姓名
        /// </summary>
        [StringLength(100)]
        public string? SenderName { get; set; }

        /// <summary>
        /// 通知参数
        /// </summary>
        public string? Parameters { get; set; }

        /// <summary>
        /// 附件列表
        /// </summary>
        public string? Attachments { get; set; }

        /// <summary>
        /// 调度时间
        /// </summary>
        public DateTime? ScheduledTime { get; set; }

        /// <summary>
        /// 过期时间
        /// </summary>
        public DateTime? ExpirationTime { get; set; }

        /// <summary>
        /// 最大重试次数
        /// </summary>
        [Range(0, 10)]
        public int MaxRetryCount { get; set; } = 3;

        /// <summary>
        /// 分类标签
        /// </summary>
        [StringLength(100)]
        public string? Category { get; set; }

        /// <summary>
        /// 业务数据
        /// </summary>
        public string? BusinessData { get; set; }

        /// <summary>
        /// 是否静默发送
        /// </summary>
        public bool IsSilent { get; set; } = false;

        /// <summary>
        /// 是否需要确认
        /// </summary>
        public bool RequiresConfirmation { get; set; } = false;

        /// <summary>
        /// 确认截止时间
        /// </summary>
        public DateTime? ConfirmationDeadline { get; set; }

        /// <summary>
        /// 地理位置限制
        /// </summary>
        public string? LocationRestriction { get; set; }

        /// <summary>
        /// 时间限制
        /// </summary>
        public string? TimeRestriction { get; set; }

        /// <summary>
        /// 设备限制
        /// </summary>
        public string? DeviceRestriction { get; set; }

        /// <summary>
        /// 关联ID
        /// </summary>
        public Guid? RelatedEntityId { get; set; }

        /// <summary>
        /// 关联类型
        /// </summary>
        [StringLength(100)]
        public string? RelatedEntityType { get; set; }

        /// <summary>
        /// 租户ID
        /// </summary>
        public Guid? TenantId { get; set; }

        /// <summary>
        /// 自定义属性
        /// </summary>
        public Dictionary<string, object>? Properties { get; set; }
    }
}